Magnetic field sensors can be used to detect the angle of a rotating magnetic field. Such sensors are used in various applications such as robotics, automobiles, automated manufacturing systems, etc. They are often used as a type of encoder to determine the position or speed of a rotating object. For example, a magnetic sensor can be used to detect a magnet placed on the end of a rotating cam shaft to determine the angular position or rotational speed of the shaft.
Certain magnetic field sensors use magnetoresistance or giant-magnetoresistance elements to detect the magnetic field. These elements are multilayer structures often consisting a magnetic sensing layer, a non-magnetic layer, and a magnetic fixed or pinned layer. During operation, an external magnetic field may alter the magnetic direction (i.e. the direction of the magnetic moment) of the sensing layer, thus altering an electrical resistance through the magnetresistance element. Typically, the magnetic direction of the pinned layer remains fixed. However, a strong magnetic field can alter or reverse the magnetic direction of the pinned layer, which can cause so-called spin-flop errors in the output of the magnetic field sensor.